package com.stonefinal.singlelogin.config;

import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        //首页所有人都可以访问，功能页只能对有权限的人看
        http.authorizeRequests().antMatchers("/").permitAll().
                antMatchers("/").hasRole("vip1");

        //没有权限会跳到登录页
        http.formLogin();

    }
}
